package com.learn.redis.lock.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;

/**
 * @author PC
 * 幂等性注解
 */

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Lock {
    //锁键
    String lockKey();

    //等待时间
    long waitTime() default 60L;

    //自动释放时间
    long leaseTime();

    //时间单位
    TimeUnit timeUnit() default TimeUnit.SECONDS;

    //锁类型
    String lockType() default "FAIR";

    //校验lockKey是否存在
    boolean lockKeyExistFlag() default false;
}
